<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
import {login, list} from '@/api/user'
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'test'
    }
  },
  mounted(){
    this.init()
    // console.log(process.env)
    // console.log(this.$store.state.user)
    
  },
  methods:{
    async init (){
      console.log(1)
      // console.log(login('rty',123))
      await login('rty',123).then(res=>{
        // console.log(res)
        console.log(2)
        // this.Storage.set('token',res.data.token)
        this.$store.dispatch('setToken',res.data.token)

        
      })
      console.log(3)
      list().then(res=>{
          console.log(res)
          console.log(4)
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.hello{
  h1{
    color:#333
  }
}
</style>
